package net.hn.hnms.biz.equipment.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.api.mine.model.AlarmMessageItemVo;
import net.hn.hnms.biz.equipment.domain.CoalMineSysPointPo;
import net.hn.hnms.biz.equipment.domain.vo.ChartCggdVO;
import net.hn.hnms.biz.equipment.domain.vo.ChartVo;
import net.hn.hnms.biz.equipment.domain.vo.MiningChartVO;
import net.hn.hnms.biz.equipment.service.EquipmentService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Author: PanSX
 * Date: 2022/8/13 14:25
 */
@Api(value = "重大设备制器", tags = {"重大设备"})
@RestController
@RequestMapping("/equipment")
@RequiredArgsConstructor
public class EquipmentController {
    private final EquipmentService equipmentService;

    @GetMapping("zdsb")
    @ApiOperation("重大设备")
    public R<Map> zdsb(@ApiParam(value = "重大设备类型（compressor 压风，drainage 排水，fan 通风,coalflow 煤流,inclineShaft 斜井,support 支架阻力，mining 采煤，thermalshock 协同开采，gasext 瓦斯抽采，drivage 快速掘进）", required = true) String equipmentType
            , @ApiParam(value = "某个设备") String apiPage,@ApiParam(value = "煤矿编码") String mineCode) {
        return R.ok(equipmentService.queryCurrentByEquType(equipmentType, apiPage,mineCode));
    }

    @GetMapping("zjyl")
    @ApiOperation("支架压力")
    @AutoSetMineCode
    public R<ChartVo> zjyl(String mineCode) {
        return R.ok(equipmentService.zjylChart(mineCode));
    }

    @GetMapping("getStartStopByEquipment")
    @ApiOperation("某种设备的启停结果集")
    public R<List<CoalMineSysPointPo>> getStartStopByEquipment(@ApiParam(value = "重大设备类型（compressor 压风，drainage 排水，fan 通风,coalflow 煤流,inclineShaft 斜井,support 支架阻力，mining 采煤，thermalshock 协同开采）", required = true) String equipmentType
            , @ApiParam(value = "某个设备") String apiPage) {
        return R.ok(equipmentService.getStartStopByEquipment(equipmentType, apiPage));
    }

    @GetMapping("alarmMessageItem")
    @ApiOperation("安全监控报警消息")
    public R<List<AlarmMessageItemVo>> alarmMessageItem(@ApiParam("设备类型") String equipmentType){
        return R.ok(equipmentService.alarmMessageItem(equipmentType));
    }

    @GetMapping("cggd")
    @ApiOperation("采割高度")
    @AutoSetMineCode
    public R<ChartCggdVO> cggd(String mineCode) {
        return R.ok(equipmentService.cggdChart(mineCode));
    }

    @GetMapping("miningChart")
    @ApiOperation("割煤循环曲线")
    @AutoSetMineCode
    public R<MiningChartVO> miningChart(String mineCode) {
        return R.ok(equipmentService.miningChart(mineCode));
    }
}
